﻿using XemlUtilities.ISA;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using XemlUtilities;
using System.Diagnostics;
using System.Data;
using System.IO;

namespace XemlTest
{
    
    
    /// <summary>
    ///This is a test class for MetabolitesTest and is intended
    ///to contain all MetabolitesTest Unit Tests
    ///</summary>
    [TestClass()]
    public class MetabolitesTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Metabolites Constructor
        ///</summary>
        [TestMethod()]
        [DeploymentItem("XemlUtilities.dll")]
        public void MetabolitesConstructorTest()
        {
            Guid xemlId = new Guid("10b38aaf-b977-4950-85b8-f4775f66658d");
            string connectionString = "Data Source=R710SQLJAHU.mpimp-golm.mpg.de;Initial Catalog=GMD;Integrated Security=True;Application Name=\"gmd web services\";Pooling=TRUE;";
            Metabolites target = new Metabolites(xemlId, connectionString);
            //Debug.WriteLine(target.Rows.Count);
            //foreach (DataRow item in target.Rows)
            //{
            //    Debug.WriteLine(item.Field<String>("database_identifier"));
            //    Debug.WriteLine(item.Field<String>("chemical_formula"));
            //    foreach (var i in item.ItemArray)
	           // {
            //        Debug.WriteLine(i.ToString());
	           // }
            //}


            MemoryStream writer = new MemoryStream();
            target.Write(writer);

            Debug.WriteLine(String.Join(" ", writer.ToArray()));

        }
    }
}
